package com.ruoyi.lol.service.impl;

import com.ruoyi.lol.domain.LolGameAnalysis;
import com.ruoyi.lol.mapper.LolGameAnalysisMapper;
import com.ruoyi.lol.service.ILolGameAnalysisService;
import com.ruoyi.lol.service.ILolGameRecordService;
import io.lettuce.core.output.DoubleListOutput;
import org.apache.poi.hpsf.Decimal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.DecimalFormat;
import java.util.List;

/**
 * 游戏数据分析Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-04-20
 */
@Service
public class LolGameAnalysisServiceImpl implements ILolGameAnalysisService
{
    @Autowired
    private LolGameAnalysisMapper lolGameAnalysisMapper;


    /**
     * 查询游戏数据分析列表
     *
     * @return 游戏数据分析
     */
    @Override
    public List<LolGameAnalysis> selectLolGameAnalysisList(LolGameAnalysis lolGameAnalysis)
    {
        List<LolGameAnalysis> list = lolGameAnalysisMapper.selectLolGameAnalysis(lolGameAnalysis);
        DecimalFormat df = new DecimalFormat("#0.00");
        for (LolGameAnalysis item:list) {
            Double rate = Double.parseDouble(item.getWinRate());
            item.setWinRate(df.format(rate)+"%");
        }
//        list.forEach(item->);
        return list;
    }


}
